package com.junke.question.service.controller;

import com.alibaba.fastjson.JSON;
import com.junke.question.service.entity.SysUser;
import com.junke.question.service.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/test")
public class TestController {


    @Autowired
    ISysUserService sysUserService;

    @PostMapping(value = "/get")
    @ResponseBody
    @PreAuthorize("hasAuthority('admin')")
    public String getUser(@RequestBody SysUser sysUser){
        return JSON.toJSONString(sysUser);
    }
}
